mod serde_datetime {
    use std::str::FromStr;
    use rbatis::rbdc::DateTime;
    use serde::{self, Deserialize, Deserializer, Serializer};

    const TIMESTAMP_FORMAT: &str = "%Y-%m-%d %H:%M:%S"; // 你可以根据需要调整这个格式

    pub fn serialize<S: Serializer>(time: &DateTime, serializer: S) -> Result<S::Ok, S::Error> {
        // todo! 返回时间字符串
        let s = time.format(TIMESTAMP_FORMAT).to_string();
        serializer.serialize_str(&s)
    }

    pub fn deserialize<'de, D>(deserializer: D) -> Result<DateTime, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s: &str = Deserialize::deserialize(deserializer)?;
        DateTime::from_str(s).map_err(serde::de::Error::custom)
    }
}


mod serde_option_datetime {
    use std::str::FromStr;
    use rbatis::rbdc::DateTime;
    use serde::{self, Deserialize, Deserializer, Serializer};

    const TIMESTAMP_FORMAT: &str = "%Y-%m-%d %H:%M:%S"; // 你可以根据需要调整这个格式

    pub fn serialize<S: Serializer>(time: &Option<DateTime>, serializer: S) -> Result<S::Ok, S::Error> {
        // todo! 返回时间字符串
        let s = time.format(TIMESTAMP_FORMAT).to_string();
        serializer.serialize_str(&s)
    }

    pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<DateTime>, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s: &str = Deserialize::deserialize(deserializer)?;
        DateTime::from_str(s).map_err(serde::de::Error::custom)
    }
}